<extend name="common/base" />
<taglib name="CMS\TagLib\Zui" />
<block name="header">
	<div class="zui-pageHeader">
		<h2>插件配置 [ {$data.title} ]</h2>
	</div>
</block>

<block name="body">
<form action="{:url('saveConfig')}" class="form-horizontal" method="post" data-toggle="ajaxform">
    <empty name="custom_config">
        <foreach name="data['config']" item="form" key="o_key">
            <div class="form-group row">
                <div class="input-group">
                    <switch name="form.type">
                        <case value="text">
                            <zui:input type="text" name="config[{$o_key}]" value="{$form.value}" title="{$form.title|default=''}" note="form.tip" />
                        </case>
                        <case value="password">
                            <zui:input type="password" name="config[{$o_key}]" value="{$form.value}" title="{$form.title|default=''}" note="form.tip" />
                        </div>
                        </case>
                        <case value="hidden">
                            <zui:input type="hidden" name="config[{$o_key}]" value="{$form.value}" note="form.tip" />
                        </case>
                        <case value="radio">
                            <zui:radio name="config[{$o_key}]" checked="$form[value]" radios="form.options" title="{$form.title|default=''}" note="form.tip" />
                        </case>
                        <case value="checkbox">
                            <zui:checkbox name="config[{$o_key}]" checked="$form[value]" options="form[options]" title="{$form.title|default=''}" note="form.tip" />
                        </case>
                        <case value="select">
                            <zui:select name="config[{$o_key}]" selected="$form[value]" options="form[options]" title="{$form.title|default=''}" note="form.tip" />
                        </case>
                        <case value="textarea">
                            <zui:input type="textarea" name="config[{$o_key}]" value="{$form.value}" title="{$form.title|default=''}" note="form.tip" />
                        </case>
                        <case value="group">
                            <div class="tab-wrap show">
                            <ul class="nav-tabs nav">
                                <volist name="form.options" id="li">
                                    <li data-tab="tab{$i}" <eq name="i" value="1">class="active"</eq>><a href="#tab{$i}" data-toggle="tab">{$li.title}</a></li>
                                </volist>
                            </ul>
                            <div class="tab-content">
                            <volist name="form.options" id="tab">
                                <div id="tab{$i}" class="tab-pane <eq name="i" value="1">active</eq> tab{$i}">
                                    <foreach name="tab['options']" item="tab_form" key="o_tab_key">
                                    <div class="form-group row">
                                        <div class="input-group">
                                        <switch name="tab_form.type">
                                            <case value="text">
                                                <zui:input type="text" name="config[{$o_tab_key}]" value="{$tab_form.value}" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="password">
                                                <zui:input type="password" name="config[{$o_tab_key}]" value="{$tab_form.value}" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="hidden">
                                                <zui:input type="hidden" name="config[{$o_tab_key}]" value="{$tab_form.value}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="radio">
                                                <zui:radio name="config[{$o_tab_key}]" checked="$tab_form[value]" radios="tab_form.options" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="checkbox">
                                                <zui:checkbox name="config[{$o_tab_key}]" checked="$tab_form[value]" options="tab_form[options]" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="select">
                                                <zui:select name="config[{$o_tab_key}]" selected="$tab_form[value]" options="tab_form[options]" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            <case value="textarea">
                                                <zui:input type="textarea" name="config[{$o_tab_key}]" value="{$tab_form.value}" title="{$tab_form.title|default=''}" note="{$tab_form.tip}" />
                                            </case>
                                            </switch>
                                            </div>
                                        </div>
                                    </foreach>
                                </div>
                            </volist>
                            </div>
                            </div>
                        </case>
                    </switch>
                </div>
            </div>
        </foreach>
    <else />
        <present name="custom_config">
            {$custom_config}
        </present>
    </empty>
    <input type="hidden" name="id" value="{:I('id')}" readonly>
</form>
</block>
<block name="footer">
    <div class="zui-pageFooter">
		<button type="submit" class="btn btn-success ajax-post" target-form="form-horizontal">确 定</button>
		<button class="btn btn-danger" onclick="javascript:$.CurrentDialog.dialog('closeCurrent');return false">返 回</button>
    </div>
</block>

<block name="script">
</block>
